/**
 * outsider.com.cn Inc.
 * Copyright (c) 2011-2022 All Rights Reserved.
 */
package com.yuanmeng.common.core.enums;

import com.yuanmeng.common.core.exception.ServiceException;

import lombok.Getter;

/**
 * @author outsider
 * @version Id: StatusEnum.java, v 0.1 2022/6/1 17:16 outsider Exp $$
 */
@Getter
public enum PopupTypeEnum {
    ACTIVE_PRODUCT("ACTIVE_PRODUCT", "新活动上线"),

    SPIKE("SPIKE", "限时抢购"),

    GROUP("GROUP", "拼团活动"),

    COUPON_LIST("COUPON_LIST", "优惠券列表"),

    ACCEPT_COUPON("ACCEPT_COUPON", "优惠券领取"),

    THIRD_LINK("THIRD_LINK", "第三方链接"),

    PRODUCT_DETAIL("PRODUCT_DETAIL", "商品详情");

    private String code;

    private String message;

    PopupTypeEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public static void validatePopupType(String popupType) {
        int num = 0;
        for(PopupTypeEnum ENUM : PopupTypeEnum.values()) {
            if(ENUM.code.equals(popupType)) {
                num ++;
            }
        }
        if(num == 0) {
            throw new ServiceException("请求参数非法：popupType");
        }
    }
}